import pygame

class Menu(object):
    def __init__(self):
        super(Menu,self).__init__()
        self.status = 0
        self.font = pygame.font.Font(None,32)
        self.big_font = pygame.font.Font(None,72)
        self.logo = pygame.image.load("../media/images/DisNoteslogo.png")
        self.cursor = pygame.image.load("../media/images/note.png").convert_alpha()
        self.prev_highscore = 0
        self.highscore = 0
        self.new_record = False
    def update(self):
        pass
    def draw(self,screen):
        img_rect = self.logo.get_rect()
        screen.blit(self.logo, pygame.Rect(600,25,img_rect.right,img_rect.bottom))
        if self.status == 0:
            font_surf = self.font.render("Start Game",1,(200,200,0))
        else:
            font_surf = self.font.render("Start Game",1,(0,0,0))
        font_rect = font_surf.get_rect()
        screen.blit(font_surf,pygame.Rect(100,300,font_rect.right,font_rect.bottom))
        if self.status == 1:
            font_surf = self.font.render("Two Player",1,(200,200,0))
        else:
            font_surf = self.font.render("Two Player",1,(0,0,0))
        font_rect = font_surf.get_rect()
        screen.blit(font_surf,pygame.Rect(100,332,font_rect.right,font_rect.bottom))
        if self.status == 2:
            font_surf = self.font.render("How To Play",1,(200,200,0))
        else:
            font_surf = self.font.render("How To Play",1,(0,0,0))
        font_rect = font_surf.get_rect()
        screen.blit(font_surf,pygame.Rect(100,364,font_rect.right,font_rect.bottom))
        if self.status == 3:
            font_surf = self.font.render("Credits",1,(200,200,0))
        else:
            font_surf = self.font.render("Credits",1,(0,0,0))
        font_rect = font_surf.get_rect()
        screen.blit(font_surf,pygame.Rect(100,396,font_rect.right,font_rect.bottom))
        if self.status == 4:
            font_surf = self.font.render("Quit",1,(200,200,0))
        else:
            font_surf = self.font.render("Quit",1,(0,0,0))
        font_rect = font_surf.get_rect()
        screen.blit(font_surf,pygame.Rect(100,428,font_rect.right,font_rect.bottom))
        font_surf = self.big_font.render("Highscore: %d"%self.highscore,1,(0,0,0))
        font_rect = font_surf.get_rect()
        screen.blit(font_surf,pygame.Rect(1200-font_rect.right,400,font_rect.right,font_rect.bottom))
        if self.new_record == True:
            font_surf = self.font.render("New Record!",1,(255,0,0))
            font_rect = font_surf.get_rect()
            screen.blit(font_surf,pygame.Rect(1000-font_rect.right,480,font_rect.right,font_rect.bottom))
        img_rect = self.cursor.get_rect()
        screen.blit(self.cursor,pygame.Rect(10,255+(32*self.status),img_rect.right,img_rect.bottom))

    def update_highscore(self,new_score):
        if new_score > self.highscore:
            self.prev_highscore = self.highscore
            self.highscore = new_score
            self.new_record = True
        else:
            self.new_record = False
